<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>俄罗斯方块</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="container">
        <h1>俄罗斯方块</h1>
        <div class="game-wrapper">
            <canvas id="gameCanvas"></canvas>
            <div class="side-panel">
                <div>
                    <h2>分数</h2>
                    <p id="score">0</p>
                </div>
                <div>
                    <h2>下一个</h2>
                    <canvas id="nextPieceCanvas"></canvas>
                </div>
                <div>
                    <h2>等级</h2>
                    <p id="level">1</p>
                </div>
                <button id="startButton">开始游戏</button>
                <button id="leaderboardButton">查看排行榜</button>
                <p id="statusMessage" class="status-message"></p>
            </div>
        </div>
    </div>

    <!-- 游戏结束弹窗 -->
    <div id="gameOverModal" class="modal">
        <div class="modal-content">
            <h2>游戏结束!</h2>
            <p>你的最终得分: <span id="finalScore">0</span></p>
            <input type="text" id="playerNameInput" placeholder="输入你的昵称 (最多50字符)" maxlength="50">
            <div class="modal-buttons">
                <button id="submitScoreButton">提交分数</button>
                <button id="restartButton">重新开始</button>
            </div>
            <p id="submitStatus" class="status-message"></p>
        </div>
    </div>

    <!-- 排行榜弹窗 -->
    <div id="leaderboardModal" class="modal">
        <div class="modal-content">
            <h2>排行榜 (Top 10)</h2>
            <div id="leaderboardContent">
                <p>加载中...</p>
            </div>
            <div class="modal-buttons">
                <button id="closeLeaderboardButton">关闭</button>
                <button id="refreshLeaderboardButton">刷新</button>
            </div>
             <p id="leaderboardStatus" class="status-message"></p>
        </div>
    </div>

    <!-- 引入 JS 文件 -->
    <script src="js/constants.js"></script>
    <script src="js/api.js"></script>
    <script src="js/ui.js"></script>
    <script src="js/game.js"></script>
    <script src="js/main.js"></script>
</body>
</html>